<?php

class Page extends Smarty {

    var $PageTitle;
    var $PageDescr;
    var $PageName;
    var $DisplayTemplate;
    var $smarty;

    public function __construct($sma) {
        $this->smarty = $sma;
        $this->PageName = $this->getPageName();


        switch ($this->PageName) {
            case 'home':
            default:


                $this->smarty->assign('categories', $this->getAllMainCats());

                $this->PageTitle = 'Начало';
                $this->PageDescr = 'Начало - meta описание';
                $this->DisplayTemplate = 'home.tpl';
                break;
        }
        $this->smarty->assign('PageName', $this->PageName);
        $this->smarty->assign('PageTitle', $this->PageTitle);
        $this->smarty->assign('PageDescr', $this->PageDescr);
        $this->smarty->assign('PageName', $this->PageName);
    }

    private function getPageName() {
        if (!$_GET['PageName'])
            return 'home';
        else
            return $_GET['PageName'];
    }

    private function getAllMainCats() {
//        return runSQL('SELECT * FROM categories WHERE parent_category_id = 0 AND active=1');
    }

}

?>
